// import e from "express";
import Vue from "vue";
import VueRouter from "vue-router";
import store from '../store/index'
Vue.use(VueRouter);

const routes = [{
        path: '/',
        redirect: '/index'
    },
    {
        path: '/index',
        name: 'index',
        component: () =>
            import ('../views/index.vue'),
    },
    {
        path: '/gedan',
        name: 'gedan',
        component: () =>
            import ('../views/gedan.vue'),
    },
    {
        path: '/geshou',
        name: 'geshou',
        component: () =>
            import ('../views/geshou.vue'),
    },
    {
        path: '/cart',
        name: 'cart',
        component: () =>
            import ('../views/cart.vue'),
    },
    {
        path: '/dizhi',
        name: 'dizhi',
        component: () =>
            import ('../views/dizhi.vue'),
    },
    {
        path: '/order',
        name: 'order',
        component: () =>
            import ('../views/order.vue'),
    },
    {
        path: '/dingdan',
        name: 'dingdan',
        component: () =>
            import ('../views/dingdan.vue'),
    },
    {
        path: '/xiangqing',
        name: 'xiangqing',
        component: () =>
            import ('../views/xiangqing.vue'),
    },
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});
// router.beforeEach((to, from, next) => {
//     if (store.state.user.id) {
//         next()

//     } else {
//         if (to.path == "/index") {
//             next()
//         } else {
//             store.commit("show", true)
//         }
//     }
//     console.log(to);
// })
export default router;